{/*<script type="text/javascript">*/}

	jQuery(document).ready(function(){


        fuckHaoZhi();

                   //提交时验证品相编码
		checkCustomize = function(){
			var newArray = new Array();
			var nextArray = new Array();
			var submitdtlid0 = jQuery("#submitdtlid0").val();
			var array = submitdtlid0.split(",");
			for(var i=0; i<array.length; i++){
				var pxbm = jQuery("#field6077_"+array[i]).val();
				var sl = jQuery("#field6196_"+array[i]).val();
				if(pxbm != ""){
					newArray.push(pxbm);
				}
				if(pxbm != "" && sl != ""){
					nextArray.push(pxbm+"@"+sl);
				}
			}
			for(var j = 0; j < newArray.length-1; j++){
				for(var k = j+1; k < newArray.length; k++){
					if(jQuery.trim(newArray[j]) == jQuery.trim(newArray[k])){
						alert("品项编码重复,请重新输入!");
						return false;
					}
				}
			} 
			//alert(nextArray.join());打印数组
			checkbox(nextArray);
			return true; 
		}
		
		//检查明细表的品相编码在库数量是否充足,如果在库不足给予提示,但不干预流程的提交
		function checkbox(array){
			jQuery.ajax({
				url:"/interface/haozhi/check.jsp",
				dataType : "text",  	//传递的数据类型
				type : "post",      	//传递方式
				async : false,
				data : {
					"array" : array.join()			
				},
				success: function(text){
					var mes = jQuery.trim(text); 
					if(mes != "" && mes != null){
						alert(mes);
					}
				}
			});
		} 
		//分类只保留喷绘和喷绘安装
		var html = jQuery("select[temptitle='类别']").attr("id","ssssssssssssssssss")
		//删除非“”和非喷绘开头的
		jQuery("#ssssssssssssssssss option").each(function(index, domEle){
			if(domEle.innerHTML != "" && !new RegExp("喷绘").test(domEle.innerHTML)){
				jQuery(domEle).remove();
			}
		});


    });

//绑定事件设置订货数量
function fuckHaoZhi() {
            $("#submitdtlid0").bindPropertyChange(function() {
                var ids = jQuery("#submitdtlid0").val().split(",");
                for (var index = 0; index < ids.length; index++) {
                   			$("#field6172_"+index).change(function(){
                            var id = $(this).attr("id").split("_")[1];
                            var kuan = parseFloat($("#field6172_"+id).val());
                            var gao =  parseFloat($("#field6173_"+id).val());
                            var sjsl = parseInt($("#field6196_"+id).val());
                            //计算订货数量
                            //var dhsl = (~~((kuan*gao*sjsl)/100))+1
                            var dhsl = Math.ceil((kuan*gao)/100)*sjsl;
                            //赋值
                            $("#field6195_"+id).val(dhsl);
                            $("#field6195_"+id+"span").css("display","none")
                            console.log("订货数量为："+dhsl);
                    });
                    $("#field6173_"+index).change(function(){
                            var id = $(this).attr("id").split("_")[1];
                            var kuan = parseFloat($("#field6172_"+id).val());
                            var gao =  parseFloat($("#field6173_"+id).val());
                            var sjsl = parseInt($("#field6196_"+id).val());
                            //计算订货数量
                            //var dhsl = (~~((kuan*gao*sjsl)/100))+1
                            var dhsl =  Math.ceil((kuan*gao)/100)*sjsl;
                            //赋值
                            $("#field6195_"+id).val(dhsl);
                            $("#field6195_"+id+"span").css("display","none")
                            console.log("订货数量为："+dhsl);
                    });
                    $("#field6196_"+index).change(function(){
                            var id = $(this).attr("id").split("_")[1];
                            var kuan = parseFloat($("#field6172_"+id).val());
                            var gao =  parseFloat($("#field6173_"+id).val());
                            var sjsl = parseInt($("#field6196_"+id).val());
                            //计算订货数量
                            //var dhsl = (~~((kuan*gao*sjsl)/100))+1
                            var dhsl = Math.ceil((kuan*gao)/100)*sjsl;
                            //赋值
                            $("#field6195_"+id).val(dhsl);
                            $("#field6195_"+id+"span").css("display","none")
                            console.log("订货数量为："+dhsl);
                    });
                }
            }); 
        }


{/*</script>*/}
















